When an effect is initialized, first the main_init function is executed, followed by sub_init for all subs. Every time an Enter Frame event occurs, sub_effect is executed for all active subs, followed by main_effect.
The effect functions control the objects. The sub functions are used to apply an effect on each sub, the main functions to apply an effect on the main mc (the total of all subs).
The depth of the main mc (the total of all subs) is 5.
The depths of the subs are 5, 15, 25, 35 etc.
Depths of 0, 10, 20, 30 etc. are used by the built in after image option.
All other depths can be used to create duplicate mc's or masks required for an effect.
Most variable names are free to use. The ones that are not free to use are all variables starting with a $ and the special values listed below.
glow_delay
==========
( After image delay )
Number of frames the after image runs behind.
Values below or equal to zero means no after image.
If you are using the built in after image option and want to make a sub invisible, don't use the _visibility property but set _alpha to 0 instead.
glow_factor
===========
( After image transparency )
Multiplication factor of the after image.
For example 0.5 means the after image transparency is 50% of the original.
sub_delay
=========
Delay in frames between starting the subs.
sub_order
=========
0 = Normal flow
1 = Reverse flow
2 = Inner to outer
3 = Outer to inner
4 = Left to right
5 = Right to left
6 = Top to bottom
7 = Bottom to top
8 = Top left to bottom right
9 = Bottom right to top left
10 = Bottom left to top right
11 = Top right to bottom left
12 = Clockwise
13 = Counter clockwise
14 = Random
loop_delay
==========
Delay in frames before looping the total effect.
Values below zero indicate no loop.
subs_done
=========
Flag that is set by the engine when all subs have completed their sub_effect.
end_effect
==========
Flag that needs to be set when the total effect is completed.
mc
==
Reference to a movieclip.
mc.done
=======
Flag that needs to be set when a sub has completed it's sub_effect.
mc._i
=====
Number assigned to each sub starting with 0 for the sub with the lowest depth.
( for example if mc._i = 4, the depth of the sub is 45 )
mc.__x
======
Used to store initital _x value.
mc.__y
======
Used to store the initial _y value.
frame
=====
Current frame inside an effect.
deg0 - deg360 (in steps of 15 degrees)
======================================
Pre defined rad conversions.
For example Math.sin(deg60)
$padding
========
The amount of padding that is added by KM to the width and height of a sub.
For example a value of 8 indicates 8 pixels to the width and 8 pixels to the
height or in other words 4 pixels padding on all sides.
$sub_cnt
========
Internal variable indicating the amount of subs.
$i (only in sub_effect)
=======================
Sequence number of the current sub.
$smc
====
Array containing references to all sub mc's.
$mmc
====
Reference to the main mc.
onEnd
=====
Function that is called when the total effect ends.